import request from "@/utils/request.ts"

// 获取所有用户
export const getAllSystemUsers = (data) => {
    return request({
        method: "get",
        url: `/admin/acl/user/${data.page}/${data.limit}`,
        params: {
            username: data.username
        }
    })
}

// 新增用户
export const addSystemUsers = (data) => {
    return request({
        method: "post",
        url: `/admin/acl/user/save`,
        data
    })
}

//  修改用户的用户名
export const updateSystemUsers = (data) => {
    return request({
        method: "put",
        url: `/admin/acl/user/update`,
        data
    })
}

// 获取用户的已有角色与全部角色列表
export const getAllRoleListAndOwnedRoles = (id) => {
    return request({
        method: "get",
        url: `/admin/acl/user/toAssign/${id}`
    })
}

// 分配角色
export const addRoles = (data) => {
    return request({
        method: "post",
        url: `/admin/acl/user/doAssignRole`,
        data
    })
}

// id:number删除用户
export const deleteTheUser = (id) => {
    return request({
        method: "delete",
        url: `/admin/acl/user/remove/${id}`,
    })
}

// 批量删除
export const deleteSomeUsers = (data) => {
    return request({
        method: "delete",
        url: `/admin/acl/user/batchRemove`,
        data
    })
}